package br.com.repassi.tela;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import br.com.repassi.android_01_menu.R;

public class MenuActivity extends Activity {

	private static final String CATEGORIA = "android-01-menu";
	
	// Menu principal
	private static final int INSERIR = 0;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_menu);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.menu, menu);
		MenuItem mn = menu.add(0, INSERIR, 0, "Inserir");
		mn.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
		return true;
	}

	@Override
	public boolean onMenuItemSelected(int featureId, MenuItem item) {
		// Clicou no menu

		switch (item.getItemId()) {
		case INSERIR:
			Log.i(CATEGORIA, "Opcao inserir novo selecionada");
			break;
		}
		return true;

	}

}
